package com.iwhalecloud.bss.kite.cucc.service.inf;

import org.springframework.stereotype.Service;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.entity.InfService;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.common.callclient.service.ICuccQueryInfService;
import com.iwhalecloud.bss.kite.dataservice.cache.DcSystemParamCache;

/**
* @Description: TODO
*
* @author lyx
* @date 2020年10月31日
* @version V1.0
* @Package com.iwhalecloud.bss.kite.cucc.service.inf
*/
@Service
public class CuccQueryInfService implements ICuccQueryInfService{
    
    @Override
    public String getUrlByType(InfService infService) {
        String type = DcSystemParamCache.getDcParamVal(KeyConsts.DC_SYSTEM_PARAM_ENV_TYPE);

        if (KiteStringUtils.equals(type, KeyConsts.DEV)) { // 开发环境
            return infService.getDevInfUrl();
        }
        else if (KiteStringUtils.equals(type, KeyConsts.TEST)) { // 测试环境
            return infService.getTestInfUrl();
        }
        else if (KiteStringUtils.equals(type, KeyConsts.PROD)) { // 生产环境
            return infService.getProdInfUrl();
        }

        return infService.getClassName();
    }
}
